#!/usr/bin/env python
#coding:utf-8

import tornado.ioloop
import tornado.options
import tornado.httpserver

from application import application

#初始化启动信息，包括了数据库的启动配置
from tornado.options import define, options
#绑定tornado实例到那个端口，默认位8000
define("port", default=8081, help="run on the given port", type=int)
#下面是db的配置信息


def main():
    tornado.options.parse_command_line()
    http_server = tornado.httpserver.HTTPServer(application,xheaders=True)
    http_server.listen(options.port)
    print('Development server is running at http://127.0.0.1:%s/' % options.port)
    print('Quit the server with Control-C')
    tornado.ioloop.IOLoop.instance().start()
    http_server.start(0)

if __name__=="__main__":
    main()